package com.twu.biblioteca;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: apple
 * Date: 28/09/13
 * Time: 11:49 AM
 * To change this template use File | Settings | File Templates.
 */
public class MoviesRepository {

    ArrayList<Movie> movies;

    MoviesRepository(){
        movies=new ArrayList<Movie>();
        addMovies();
    }

    public void addMovies(){
        movies.add(new Movie("Chennai Express","2013","Rohit Shetty","7"));
        movies.add(new Movie("Bhaag Milkha Bhaag","2013","Rakeysh Omprakash Mehra","9"));
        movies.add(new Movie("D Day","2013","Nikhil Advani","8"));
        movies.add(new Movie("Ship of Theseus","2013","Anand Gandhi","8"));
        movies.add(new Movie("Madras Cafe","2013","Shoojit Sircar","9"));
        movies.add(new Movie("Satyagraha","2013","Prakash Jha","7"));
        movies.add(new Movie("Lootera","2013","Vikramaditya Motwane","6"));
        movies.add(new Movie("Besharam","2013","Abhinav Kashyap","N/A"));
        movies.add(new Movie("Dhoom 3","2013","Vijay Krishna Acharya","N/A"));
        movies.add(new Movie("Phata Poster Nikla Hero","2013","Rajkumar Santoshi","5"));
        movies.add(new Movie("Shuddh Desi Romance","2013","Maneesh Sharma","7"));
        movies.add(new Movie("The Lunchbox","2013","Ritesh Batra","8"));
        movies.add(new Movie("Krrish 3","2013","Rakesh Roshan","N/A"));
        movies.add(new Movie("Grand Masti","2013","Indra Kumar","7"));
        movies.add(new Movie("Policegiri","2013","K. S. Ravikumar","8"));
    }

    public String displayRepository(){
        String displayMovies="\nSl.NO\tName\t\t\t\tYear\t\tDirector\t\tRating";
        displayMovies+="\n*************************************************************************************************";
        for(int i=0;i<movies.size();i++){
            displayMovies+="\n"+ (i+1) +"\t" + movies.get(i).name + "\t" + movies.get(i).year + "\t" + movies.get(i).director + "\t" +
                    movies.get(i).rating;
        }
        return displayMovies;
    }
}
